#include "head.h"

int isExist(char *fileName,int *fileExist){
    char strpwd[301];
    memset(strpwd,0,sizeof(strpwd));
    getcwd(strpwd,300);
    DIR* pdir = opendir(strpwd);
    ERROR_CHECK(pdir,NULL,"opendir");
    errno = 0;
    struct dirent* pdirent;
    while((pdirent = readdir(pdir)) != NULL){
        char* name = pdirent->d_name;
        if(strcmp(name,fileName) == 0){
            *fileExist = 1;
            break;
        }
    }
    if(errno){
        closedir(pdir);
        perror("readdir");
        exit(1);
    }
    return 0;
    //closedir(pdir);
}

